package com.example.poverty.service.impl;

import com.example.poverty.dao.VillageMapper;
import com.example.poverty.entity.Village;
import com.example.poverty.service.VillageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 前端 村户 service 实现类
 */
@Service
public class VillageServiceImpl implements VillageService {

    @Autowired
    private VillageMapper villageMapper;

    @Override
    public boolean insert(Village village) {
        return villageMapper.insert(village) > 0;
    }

    @Override
    public boolean update(Village village) {
        return villageMapper.update(village) > 0;
    }

    @Override
    public boolean delete(Integer id) {
        return villageMapper.delete(id) > 0;
    }

    @Override
    public Village selectByPrimaryKey(Integer id) {
        return villageMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Village> allVillage() {
        return villageMapper.allVillage();
    }

    @Override
    public Village getName(String name) {
        return villageMapper.getName(name);
    }

    @Override
    public List<Village> villageOfTownsId(Integer townsId) {
        return villageMapper.villageOfTownsId(townsId);
    }


}
